package code1_100.code1_10;

//给你一个字符串 s，找到 s 中最长的回文子串。
public class Code5 {

    static class Solution {

        public String longestPalindrome(String s) {
            if (s == null || s.length() < 1) {
                return "";
            }
            int start = 0, end = 0;
            for (int i = 0; i < s.length(); i++) {
                int len1 = expandAroundCenter(s, i, i);
                int len2 = expandAroundCenter(s, i, i + 1);
                int len = Math.max(len1, len2);
                if (len > end - start) {
                    start = i  - len / 2;
                    end = i + (len+1) / 2;
                }
            }
            return s.substring(start, end + 1);
        }

        public int expandAroundCenter(String s, int left, int right) {
            while (left >= 0 && right < s.length() && s.charAt(left) == s.charAt(right)) {
                --left;
                ++right;
            }
            return right - left - 2;
        }



    }

    public static void main(String[] args) {
        System.out.println(new Solution().longestPalindrome(
                "aacaa"));

        int a=3;
        int b=2;
        System.out.println(a/b);
    }
}
